﻿using Manhua3.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Windows.Networking.BackgroundTransfer;
using Windows.Storage;

namespace Manhua3.DataModel
{
    public sealed class DownloadItem : BindableBase, IDisposable
    {
        private string _comicTitle;
        public string ComicTitle
        {
            get { return this._comicTitle; }
            set { this.SetProperty(ref this._comicTitle, value); }
        }

        private string _chapterTitle;
        public string ChapterTitle
        {
            get { return this._chapterTitle; }
            set { this.SetProperty(ref this._chapterTitle, value); }
        }

        private int _completedPageCount = 0;
        public int CompletedPageCount 
        {
            get { return this._completedPageCount; }
            set { this.SetProperty(ref this._completedPageCount, value); }
        }

        private int _totalPageCount = 0;
        public int TotalPageCount
        {
            get { return _totalPageCount; }
            set { this.SetProperty(ref this._totalPageCount, value); }
        }

        private int _failedPageCount = 0;
        public int FailedPageCount
        {
            get { return _failedPageCount; }
            set { this.SetProperty(ref this._failedPageCount, value); }
        }

        private string _status = "等待下载";
        public string Status
        {
            get { return _status; }
            set { this.SetProperty(ref this._status, value); }
        }

        public List<string> Urls = new List<string>();
        public CancellationTokenSource CTS = new CancellationTokenSource();
        public List<DownloadOperation> Downloads = new List<DownloadOperation>();

        public void Dispose()
        {
            this.CTS.Dispose();
        }
    }
}
